A0:  Android article,What are floating buttons in Android systems and how can they be used?
نوشته شده توسط : dotnek

As their name suggests, the hide button is a float that is placed on the page when designing or developing an application -by-application designers and developers, and of course, it should be noted that by scrolling the page, they do not move and remain on the page. Of course, the choice of their location is the responsibility of the developers. These types of buttons are mostly used in messaging applications or their management such as Gmail. In this part of the tutorial, we want to tell you about how to create floating buttons. The Gmail page has a circular icon at the bottom right of the page with a pencil mark inside. Pressing this button will take you to the email page and write a new message.FAB stands for Floating Action Button, which requires some libraries to launch and run, such as appcompat and design.1- I will create a new project in Android Studio and we will choose a name for it. The name chosen for this project in this part of the tutorial is FAB.2- Remember that we must create the project with MinSDK 17.3- We add the library to the project. Like the following:

dependencies {
implementation fileTree (dir: 'libs', include: ['* .jar'])
implementation 'com. android. support: appcompat-v7:27.0.2'
implementation 'com. android. support:design:27.0.2'
}
In this project we use CoordinatorLayout for layout. It should be noted that the reason for using this layout is that you can use it to have better management and controls.

<? xml version = "1.0" encoding = "utf-8"?>
<android. support. Design. widget. CoordinatorLayout
xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: app = "http://schemas.android.com/apk/res-auto"
xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
tools: context = "com.dotnek.fab. MainActivity">


</android. support. Design. widget. CoordinatorLayout>
Convert the activity_main.xml to CoordinatorLayout using the code listed above.4- Add a FloatingActionButton tag to android. Support.Design. widget. FloatingActionButton.

<? xml version = "1.0" encoding = "utf-8"?>
<android. Support.Design. widget. CoordinatorLayout
xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: app = "http://schemas.android.com/apk/res-auto"
xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "match_parent"
android: layout_height = "match_parent"
tools: context = "com.dotnek.fab. MainActivity">

<android. Support.Design. widget. FloatingActionButton
android: id = "@ + id / fab"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: layout_gravity = "bottom | end"
android: layout_margin = "16dp"
android: src = "@ android: drawable / ic_dialog_email" />

</android. support. Design. widget. CoordinatorLayout>
The above code defines two values for layout_gravity. Bottom and end value. layout_margin also specifies the amount of distance it should have from the page, and the standard value to be included in the attribute is 16dp.5- We will implement the project.6- After executing the project, we will see that the button with the icon that we have defined will be displayed at the bottom right.7- If we want to move the floating button to the left, we must define layout_gravity as follows:

android: layout_gravity = "bottom | start"

8- start is opposite to end, which means the beginning of the screen.9- We will run the project again.10- FAB background color is received and determined by default using colorAccent.11- In order to be able to change the background color, we must also change the property of app: background Tint. Like the following:

 

Read more on:https://www.dotnek.com/Blog/Apps/what-are-floating-buttons-in-android-systems

link:https://dotnek.mystrikingly.com/

Related link:DotNek IOS Vývoj





:: برچسب‌ها: dotnek , seo , site ,
:: بازدید از این مطلب : 90
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0
تاریخ انتشار : سه شنبه 19 مرداد 1400 | نظرات ()
مطالب مرتبط با این پست
لیست
می توانید دیدگاه خود را بنویسید


نام
آدرس ایمیل
وب سایت/بلاگ
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

آپلود عکس دلخواه:








cache01last1628618496